﻿#ifndef ROTATEDSHAPEBASEDMATCHING_H
#define ROTATEDSHAPEBASEDMATCHING_H

#include "shape_based_matching/ShapeBasedMatching.h"
#include "line2Dup.h"

namespace Qly
{

class RotatedShapeBasedMatching : public ShapeBasedMatching
{
public:

    RotatedShapeBasedMatching();
    /**
     * @brief trainModel 训练模型，从模型中提取特征点
     * @param modelImg 模型图片
     * @param angles 角度, 第一个角度必须是 0°。
     * @param num_features 从模型中提取多少特征点
     * @return
     */
    bool trainModel(const cv::Mat &modelImg, std::vector<float> angles, int num_features);
    bool saveModel(std::string path, std::string modelName);
    bool loadModel(std::string path, std::string modelName);
    std::vector<MatchResult> runMatch(const cv::Mat &img, float score, size_t maxCount = 1);
private:
    void preprocessModelImage(const cv::Mat &modelImage, std::vector<float> angles);
    cv::Size2f minSize(std::vector<float> angles, cv::Size imageSize);
};
}

#endif // ROTATEDSHAPEBASEDMATCHING_H
